package com.lei2j.dubbo.producer.service.impl;

import com.lei2j.dubbo.service.DemoService;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;

/**
 * author: leijinjun
 * date: 2019/7/5
 */

@Service(group = "group2",executes = 5)
public class Demo2ServiceImpl implements DemoService {

    @Override
    public Object attach() {
        String attachment = RpcContext.getContext().getAttachment("attach");
        return attachment;
    }

    @Override
    public String say(String name) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "demo2:"+name;
    }

    @Override
    public String concurrent(String name) {
        System.out.println("concurrent:"+name);
        return "concurrent:"+name;
    }
}
